package com.indusfo.spc.pojo;

import com.fasterxml.jackson.annotation.JsonIgnore;
import com.indusfo.spc.common.pojo.BasePojo;
import lombok.Getter;
import lombok.Setter;

import javax.persistence.Column;
import javax.persistence.Id;
import javax.persistence.Table;
import javax.persistence.Transient;
import javax.validation.constraints.NotBlank;
import javax.validation.constraints.Size;
import java.util.Date;
import java.util.List;

/**
 * 用户信息表
 * @author xiet
 * 2018年11月23日 上午10:21:58
 */
@Table(name="sys_user")
public class User extends BasePojo {
  /**
   *
   */
  private static final long serialVersionUID = 1836999041101045081L;

  @Id
  @Column(name="USER_ID", insertable = false)
  // 用户id
  private Integer userId;

  // 用户名
  private String userCode;

  // 用户名称
  private String userName;

  //用户密码
  private String userPwd;

  // 所属部门id
  private Integer depId;

  // 所属部门名称
  private String depName;

  // 手机号码
  private String userMobilePhone;

  // 微信
  private String userWechat;

  // 电子邮箱
  private String userEmail;

  /** 盐加密 */
  @JsonIgnore  //返回时排除掉这个字段
  private String salt;

  // 职位
  private Integer userPositionId;

  // 职位（数据字典翻译）
  @Transient
  private String userPositionName;

  //创建时间
  private Date createDate;

  //更改时间
  private Date modifyDate;

  // 备注
  private String remark;

  // 数据状态
  private Integer dataState;

  // 数据状态(翻译)
  @Transient
  private String dataStateName;

  //查询条件
  @Transient
  private Integer[] depIds;

  @Transient
  private List<Integer> depIdArr;

  //查询条件
  @Transient
  private int[] userIds;

  /*
  工位id
    */
  private Integer stationId;

  /*
工位
  */
  private String stationName;

  private Integer roleId;

  @Transient
  private Integer classeId;

  @Transient
  private Integer productlineId;

  @Transient
  private String roleName;

  @Transient
  private String	access="user";

  @Transient
  private String token;

  @Transient
  private Classe classe;

  public User() {
  }

  public User(String userCode, String userName, String userPwd, String depName) {
    this.userCode = userCode;
    this.userName = userName;
    this.userPwd = userPwd;
    this.depName = depName;
  }

  public Integer getUserId() {
    return userId;
  }

  public void setUserId(Integer userId) {
    this.userId = userId;
  }

  @NotBlank(message = "用户账号不能为空")
  @Size(min = 0, max = 30, message = "用户账号长度不能超过30个字符")
  public String getUserCode() {
    return userCode;
  }

  public void setUserCode(String userCode) {
    this.userCode = userCode== null ? null : userCode.trim().replace(" ","");
  }

  public String getUserName() {
    return userName;
  }

  public void setUserName(String userName) {
    this.userName = userName== null ? null : userName.trim().replace(" ","");
  }

  public String getUserPwd() {
    return userPwd;
  }

  public void setUserPwd(String userPwd) {
    this.userPwd = userPwd== null ? null : userPwd.trim().replace(" ","");
  }

  public Integer getDepId() {
    return depId;
  }

  public void setDepId(Integer depId) {
    this.depId = depId;
  }

  public String getDepName() {
    return depName;
  }

  public void setDepName(String depName) {
    this.depName = depName;
  }

  @Size(min = 0, max = 11, message = "手机号码长度不能超过11个字符")
  public String getUserMobilePhone() {
    return userMobilePhone;
  }

  public void setUserMobilePhone(String userMobilePhone) {
    this.userMobilePhone = userMobilePhone== null ? null : userMobilePhone.trim().replace(" ","");
  }

  public String getUserWechat() {
    return userWechat;
  }

  public void setUserWechat(String userWechat) {
    this.userWechat = userWechat== null ? null : userWechat.trim().replace(" ","");
  }

  public String getUserEmail() {
    return userEmail;
  }

  public void setUserEmail(String userEmail) {
    this.userEmail = userEmail== null ? null : userEmail.trim().replace(" ","");
  }

  public String getSalt() {
    return salt;
  }

  public void setSalt(String salt) {
    this.salt = salt;
  }

  public Integer getUserPositionId() {
    return userPositionId;
  }

  public void setUserPositionId(Integer userPositionId) {
    this.userPositionId = userPositionId;
  }

  public String getUserPositionName() {
    return userPositionName;
  }

  public void setUserPositionName(String userPositionName) {
    this.userPositionName = userPositionName;
  }

  public Date getCreateDate() {
    return createDate;
  }

  public void setCreateDate(Date createDate) {
    this.createDate = createDate;
  }

  public Date getModifyDate() {
    return modifyDate;
  }

  public void setModifyDate(Date modifyDate) {
    this.modifyDate = modifyDate;
  }

  public String getRemark() {
    return remark;
  }

  public void setRemark(String remark) {
    this.remark = remark== null ? null : remark.trim().replace(" ","");
  }

  public Integer getDataState() {
    return dataState;
  }

  public void setDataState(Integer dataState) {
    this.dataState = dataState;
  }

  public String getDataStateName() {
    return dataStateName;
  }

  public void setDataStateName(String dataStateName) {
    this.dataStateName = dataStateName;
  }

  public Integer[] getDepIds() {
    return depIds;
  }

  public void setDepIds(Integer[] depIds) {
    this.depIds = depIds;
  }

  public List<Integer> getDepIdArr() {
    return depIdArr;
  }

  public void setDepIdArr(List<Integer> depIdArr) {
    this.depIdArr = depIdArr;
  }

  public int[] getUserIds() {
    return userIds;
  }

  public void setUserIds(int[] userIds) {
    this.userIds = userIds;
  }

  public Integer getStationId() {
    return stationId;
  }

  public void setStationId(Integer stationId) {
    this.stationId = stationId;
  }

  public String getStationName() {
    return stationName;
  }

  public void setStationName(String stationName) {
    this.stationName = stationName;
  }

  public Integer getRoleId() {
    return roleId;
  }

  public void setRoleId(Integer roleId) {
    this.roleId = roleId;
  }

  public String getRoleName() {
    return roleName;
  }

  public void setRoleName(String roleName) {
    this.roleName = roleName;
  }

  public String getAccess() {
    return access;
  }

  public void setAccess(String access) {
    this.access = access;
  }

  public String getToken() {
    return token;
  }

  public Integer getProductlineId() {
    return productlineId;
  }

  public void setProductlineId(Integer productlineId) {
    this.productlineId = productlineId;
  }

  public Integer getClasseId() {
    return classeId;
  }

  public void setClasseId(Integer classeId) {
    this.classeId = classeId;
  }

  public void setToken(String token) {
    this.token = token;
  }

  public Classe getClasse() {
    return classe;
  }

  public void setClasse(Classe classe) {
    this.classe = classe;
  }
}
